package com.ok.user.controller;


import com.ok.common.domain.po.Result;
import com.ok.user.domain.po.OkAddr;
import com.ok.user.service.IOkAddrService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 地址 前端控制器
 * </p>
 *
 * @author lhw
 * @since 2024-05-06
 */
@Api(tags = "地址相关接口")
@RestController
@RequestMapping("/addr")
@RequiredArgsConstructor
public class OkAddrController {

    private final IOkAddrService okAddrService;

    @ApiOperation(value = "获取地址列表")
    @GetMapping("/list")
    public Result List() {
        List<OkAddr> list = okAddrService.list();
        return Result.success(list);
    }

    @ApiOperation(value = "根据id获取地址信息")
    @GetMapping("/info")
    public Result<OkAddr> infoAddr(@RequestParam Long id){
        return Result.success(okAddrService.getById(id));
    }


}
